Downloadthis Example

Author

Shafayet Khan Shafee

Published

June 21, 2023

Downloading png file

Using {{< downloadthis files/quarto.png >}}, you can create the following download buttons that downloads the logo of quarto embedded within this rendered html document,

And it is also possible to specify,

  • the downloaded file name with dname argument,
  • button label with label argument,
  • button icon name with icon argument.
  • button type with type argument.

Downloading csv file

{{< downloadthis files/mtcars.csv dname=Mtcars label="Download the mtcars data" icon=database-fill-down type=info class=data-button id=mtcars >}}

Writing the shortcode as above creates the following button,

Downloading pdf file

{{< downloadthis files/pdf_example.pdf dname= label="Download the pdf" icon=file-earmark-pdf type=success >}}

Similarly, the above shortcode creates the following button,

Her indsættes et link til download af SOP

downloadthis::download_file(
  path = "../files/SOP.pdf",
  output_name = "CSS file from downloadthis",
  button_label = "Download pdf",
  button_type = "default",
  has_icon = FALSE,
  icon = "fa fa-save",
  self_contained = FALSE
)